package com.sy.exception;

import org.springframework.http.HttpStatus;

/**
 * 文件名称： com.meetingsystem.exception.BusinessException.java<br>
 * 功能说明： 自定义的业务异常类，所有代码中符合语法规则但不符合业务异常的情况都可以抛出该类型的异常<br>
 * 初始作者： 沈<br>
 * 创建日期： 2020/10/22 16:12<br>
 * ================================================ <br>
 * Copyright (c) 2020-2021 .All rights reserved.<br>
 */
public class BusinessException extends RuntimeException {
    /**
     * 属性描述: 出现业务异常时要返回的HTTP状态码
     */
    private HttpStatus httpStatus;
    /**
     * 属性描述: 出现业务异常时具体的错误信息
     */
    private String error;

    public HttpStatus getHttpStatus() {
        return httpStatus;
    }

    public void setHttpStatus(HttpStatus httpStatus) {
        this.httpStatus = httpStatus;
    }

    public BusinessException(HttpStatus httpStatus, String error) {
        super(error);
        this.httpStatus = httpStatus;
        this.error = error;
    }

    public BusinessException() {
    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public BusinessException(String message, HttpStatus httpStatus, String error) {
        super(message);
        this.httpStatus = httpStatus;
        this.error = error;
    }

    public BusinessException(String message, Throwable cause, HttpStatus httpStatus, String error) {
        super(message, cause);
        this.httpStatus = httpStatus;
        this.error = error;
    }

    public BusinessException(Throwable cause, HttpStatus httpStatus, String error) {
        super(cause);
        this.httpStatus = httpStatus;
        this.error = error;
    }

    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, HttpStatus httpStatus, String error) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.httpStatus = httpStatus;
        this.error = error;
    }
}
